//
//  VCAccount.m
//  Astro
//
//  Created by Trinh Huy Cuong on 12/6/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "VCAccount.h"
#import "VCAddDollar.h"

@implementation VCAccount
@synthesize login, signup;

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	self.title = @"Tai khoan";
	AstroAppDelegate *appDelegate = APP_DELEGATE;
	lb_userName.text = appDelegate.userInfo.name;
	lb_userId.text = [NSString stringWithFormat:@"%d", appDelegate.userInfo.userid];
	lb_userBirthday.text = appDelegate.userInfo.birthday;
	lb_userXu.text = [NSString stringWithFormat:@"%d", appDelegate.userInfo.numberOfXu];
	
	if (login) {
		NSMutableArray *array = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
		[array removeObject:login];
		if (signup) {
			[array removeObject:signup];	
		}
		login = nil;
		signup = nil;
		[self.navigationController setViewControllers:array];	
	}
}

- (void) viewWillAppear:(BOOL)animated{
	[self.navigationController setNavigationBarHidden:NO animated:YES];
	AstroAppDelegate *appDelegate = APP_DELEGATE;
	[appDelegate bottomButtonControlWithState:BBStateHide andType:BBTypeEast];
	appDelegate = nil;
}

- (IBAction) showVCAddDollar{
	VCAddDollar *addDollar = [[VCAddDollar alloc] initWithNibName:@"VCAddDollar" bundle:nil];
	[self.navigationController pushViewController:addDollar animated:YES];
	[addDollar release];	
}

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
